<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>执行上下文栈-面试题</title>
    <script>
        
        /**
         * 
         * 
         */
        console.log('global begin  ' + i)
        var i = 1
        
        foo(1)
        
        function foo(i) {
            if (i === 4) {
                return
            } 
            console.log('foo() begin ' + i)
            foo(i + 1)
            console.log('foo() end ' + i)
            
        }
        console.log('global end  ' + i)

        /**
         * 先执行变量提升，在执行函数提升
         */
        function a() { }
        var a
        console.log(typeof a) // function

        /**
         * b是否是window的属性
         */
        if (!(b in window)) {
            var b = 1
        } 
        console.log(b) // undefined

        /**
             var c ;
             function c(c) {
                console.log(c)
             }
             c = 1
             c(2)
         */
        var c = 1;
        function c(c) {
            console.log(c)
        }
        
        c(2) //error : c is not a function
    </script>
</head>
<body>
    
</body>
</html>
